<template>
  <div id="app">
    <div class="dragBox">
      <transition
        enter-active-class="animate__animated animate__bounceInRight"
      >
        <div
          class="homecon"
          enter-active-class="animate__animated animate__bounceInRight"
          v-show="showHome"
          leave-active-class="animate__animated animate__bounceOutRight"
        >
          <router-link to="/"
            ><span class="iconfont icon-zhuye"></span
          ></router-link>
          <router-link to="/cart"
            ><span class="iconfont icon-gouwuche1"></span
          ></router-link>
          <router-link to="/my"
            ><span class="iconfont icon-geren10"></span
          ></router-link>
        </div>
      </transition>

      <div class="picBox" @click="changeImg">
        <van-image :src="img" />
      </div>
    </div>
    <!-- 底部导航栏 -->
    <van-tabbar route active-color="red" inactive-color="grey">
      <van-tabbar-item to="/" icon="wap-home">首页</van-tabbar-item>
      <van-tabbar-item to="/category" icon="apps-o">分类</van-tabbar-item>
      <van-tabbar-item to="/cart" icon="cart-o">购物车</van-tabbar-item>
      <van-tabbar-item to="/my" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
    <!-- 底部导航栏 -->
    <router-view />
  </div>
</template>
<script>
import imgOpen from "./assets/images/open.7da41017.gif";
import imgClose from "./assets/images/close.446e8669.gif";
export default {
  data() {
    return {
      showHome: false,
      img: imgOpen,
    };
  },
  methods: {
    changeImg() {
      this.showHome = !this.showHome;
      if (this.showHome) {
        this.img = imgClose;
      } else {
        this.img = imgOpen;
      }
    },
  },
};
</script>
<style lang="less" scoped>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  .dragBox {
    .homecon {
      z-index: 10;
      position: fixed;
      top: 85vh;
      right: 2rem;
      background: #f44939;
      border-radius: 10vw;
      height: 1.1rem;
      padding: 0 2vh;
      span {
        font-size: 0.7rem;
        margin: 2vw;
        color: white;
        line-height: 1.1rem;
      }
    }
    .picBox {
      z-index: 10;
      position: fixed;
      top: 85vh;
      right: 5vw;
      transform: rotateZ(90deg);
      .van-image {
        width: 1.1rem;
        height: auto;
      }
    }
  }
  .van-tabbar {
    z-index: 9;
    .van-tabbar-item {
      font-size: 0.33rem;
    }
  }
}
</style>
